package chat;


import chat.constant.CommonConst;
import chat.util.ServerThread;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;


@Slf4j
public class Server {


    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ServerSocket socket = new ServerSocket();
        //绑定端口
        socket.bind(new InetSocketAddress(CommonConst.PORT));
        log.info("服务器启动，监听端口：{}", CommonConst.PORT);
        while (true) {
            Socket accept = socket.accept();
            new ServerThread(accept).start();
        }
    }

}
